package com.itheima.day04;
/*
案例5: 评委评分:
 */

import java.util.Scanner;

public class TestClassCase05 {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int[] score = new int[6];

        int avg=0;
        int sum=0;

        for (int i = 0; i < score.length; i++) {
            System.out.println("请输入"+(i+1)+"个评委(1--100):");
            int num = sc.nextInt();

            if (0 < num && num <= 100) {
                score[i] = num;
            } else {
                System.out.println("你输入有误!请正确输入!");
                i--;
            }
        }

        int max=score[0];
        int min=score[0];

        System.out.println("你的得分为:");
        for (int i = 0; i <score.length ; i++) {
            System.out.print(score[i] + " ");

            if (max < score[i]) {
                max = score[i];
            }

            if (min>score[i]){
                min=score[i];
            }

            sum+=score[i];

        }

        avg=(sum-max-min)/4;

        System.out.println();
        System.out.println("去掉最高分:"+max);
        System.out.println("去掉最低分:"+min);
        System.out.println("你最终的平均分:"+avg);


    }
}
